﻿using CkSoftware.GroupMe.Sdk.Core;
using CkSoftware.GroupMe.Sdk.Core.Dao;
using CkSoftware.GroupMe.Sdk.Groups.Commands;
using Newtonsoft.Json;

namespace CkSoftware.GroupMe.Sdk.Groups.Dao
{
	/// <summary>
	/// Parameters for the <see cref="CreateGroupCommand"/>.
	/// </summary>
	public class CreateGroupParameters : IWebApiCommandParameters
	{
		/// <summary>
		/// The description of the group to create.
		/// </summary>
		[JsonProperty(PropertyName = "description")]
		public string Description { get; set; }

		/// <summary>
		/// The <see cref="PictureData" /> for the group avatar image.
		/// </summary>
		[JsonIgnore]
		public PictureData GroupImage { get; set; }

		/// <summary>
		/// The full-resolution group avatar image. Get and set accesses the GroupImage property, so either GroupImage or ImageUrl must be set.
		/// </summary>
		[JsonProperty(PropertyName = "image_url")]
		public string ImageUrl
		{
			get { return GroupImage != null ? GroupImage.Url : string.Empty; }
			set { GroupImage = new PictureData {Url = value}; }
		}

		/// <summary>
		/// Defines if the group is open for share / free to join.
		/// </summary>
		[JsonProperty(PropertyName = "share")]
		public bool IsOpenForSharing { get; set; }

		/// <summary>
		/// The name of the new group.
		/// </summary>
		[JsonProperty(PropertyName = "name")]
		public string Name { get; set; }
	}
}